// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers.  See the top-level LICENSE file for dates and other
// details.  No copyright assignment is required to contribute to VisIt.

#include <PyExtrudeStackedAttributes.h>
#include <ObserverToCallback.h>
#include <stdio.h>
#include <Py2and3Support.h>

// ****************************************************************************
// Module: PyExtrudeStackedAttributes
//
// Purpose:
//   This class contains attributes for the extrude operator.
//
// Note:       Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation:   omitted
//
// ****************************************************************************

//
// This struct contains the Python type information and a ExtrudeStackedAttributes.
//
struct ExtrudeStackedAttributesObject
{
    PyObject_HEAD
    ExtrudeStackedAttributes *data;
    bool        owns;
    PyObject   *parent;
};

//
// Internal prototypes
//
static PyObject *NewExtrudeStackedAttributes(int);
std::string
PyExtrudeStackedAttributes_ToString(const ExtrudeStackedAttributes *atts, const char *prefix, const bool forLogging)
{
    std::string str;
    char tmpStr[1000];

    {   const double *axis = atts->GetAxis();
        snprintf(tmpStr, 1000, "%saxis = (", prefix);
        str += tmpStr;
        for(int i = 0; i < 3; ++i)
        {
            snprintf(tmpStr, 1000, "%g", axis[i]);
            str += tmpStr;
            if(i < 2)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    if(atts->GetByVariable())
        snprintf(tmpStr, 1000, "%sbyVariable = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%sbyVariable = 0\n", prefix);
    str += tmpStr;
    snprintf(tmpStr, 1000, "%sdefaultVariable = \"%s\"\n", prefix, atts->GetDefaultVariable().c_str());
    str += tmpStr;
    {   const stringVector &scalarVariableNames = atts->GetScalarVariableNames();
        snprintf(tmpStr, 1000, "%sscalarVariableNames = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < scalarVariableNames.size(); ++i)
        {
            snprintf(tmpStr, 1000, "\"%s\"", scalarVariableNames[i].c_str());
            str += tmpStr;
            if(i < scalarVariableNames.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const stringVector &visualVariableNames = atts->GetVisualVariableNames();
        snprintf(tmpStr, 1000, "%svisualVariableNames = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < visualVariableNames.size(); ++i)
        {
            snprintf(tmpStr, 1000, "\"%s\"", visualVariableNames[i].c_str());
            str += tmpStr;
            if(i < visualVariableNames.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const doubleVector &extentMinima = atts->GetExtentMinima();
        snprintf(tmpStr, 1000, "%sextentMinima = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < extentMinima.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%g", extentMinima[i]);
            str += tmpStr;
            if(i < extentMinima.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const doubleVector &extentMaxima = atts->GetExtentMaxima();
        snprintf(tmpStr, 1000, "%sextentMaxima = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < extentMaxima.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%g", extentMaxima[i]);
            str += tmpStr;
            if(i < extentMaxima.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const doubleVector &extentScale = atts->GetExtentScale();
        snprintf(tmpStr, 1000, "%sextentScale = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < extentScale.size(); ++i)
        {
            snprintf(tmpStr, 1000, "%g", extentScale[i]);
            str += tmpStr;
            if(i < extentScale.size() - 1)
            {
                snprintf(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        snprintf(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    const char *variableDisplay_names = "NodeHeight, CellHeight, VariableIndex, OriginalData";
    switch (atts->GetVariableDisplay())
    {
      case ExtrudeStackedAttributes::NodeHeight:
          snprintf(tmpStr, 1000, "%svariableDisplay = %sNodeHeight  # %s\n", prefix, prefix, variableDisplay_names);
          str += tmpStr;
          break;
      case ExtrudeStackedAttributes::CellHeight:
          snprintf(tmpStr, 1000, "%svariableDisplay = %sCellHeight  # %s\n", prefix, prefix, variableDisplay_names);
          str += tmpStr;
          break;
      case ExtrudeStackedAttributes::VariableIndex:
          snprintf(tmpStr, 1000, "%svariableDisplay = %sVariableIndex  # %s\n", prefix, prefix, variableDisplay_names);
          str += tmpStr;
          break;
      case ExtrudeStackedAttributes::OriginalData:
          snprintf(tmpStr, 1000, "%svariableDisplay = %sOriginalData  # %s\n", prefix, prefix, variableDisplay_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    snprintf(tmpStr, 1000, "%slength = %g\n", prefix, atts->GetLength());
    str += tmpStr;
    snprintf(tmpStr, 1000, "%ssteps = %d\n", prefix, atts->GetSteps());
    str += tmpStr;
    if(atts->GetPreserveOriginalCellNumbers())
        snprintf(tmpStr, 1000, "%spreserveOriginalCellNumbers = 1\n", prefix);
    else
        snprintf(tmpStr, 1000, "%spreserveOriginalCellNumbers = 0\n", prefix);
    str += tmpStr;
    return str;
}

static PyObject *
ExtrudeStackedAttributes_Notify(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    obj->data->Notify();
    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetAxis(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    PyObject *packaged_args = 0;
    double *vals = obj->data->GetAxis();

    if (!PySequence_Check(args) || PyUnicode_Check(args))
        return PyErr_Format(PyExc_TypeError, "Expecting a sequence of numeric args");

    // break open args seq. if we think it matches this API's needs
    if (PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PySequence_Check(packaged_args) && !PyUnicode_Check(packaged_args) &&
            PySequence_Size(packaged_args) == 3)
            args = packaged_args;
    }

    if (PySequence_Size(args) != 3)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "Expecting 3 numeric args");
    }

    for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
    {
        PyObject *item = PySequence_GetItem(args, i);

        if (!PyNumber_Check(item))
        {
            Py_DECREF(item);
            Py_XDECREF(packaged_args);
            return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
        }

        double val = PyFloat_AsDouble(item);
        double cval = double(val);

        if (val == -1 && PyErr_Occurred())
        {
            Py_XDECREF(packaged_args);
            Py_DECREF(item);
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
        {
            Py_XDECREF(packaged_args);
            Py_DECREF(item);
            return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
        }
        Py_DECREF(item);

        vals[i] = cval;
    }

    Py_XDECREF(packaged_args);

    // Mark the axis in the object as modified.
    obj->data->SelectAxis();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetAxis(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the axis.
    PyObject *retval = PyTuple_New(3);
    const double *axis = obj->data->GetAxis();
    for(int i = 0; i < 3; ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(axis[i]));
    return retval;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetByVariable(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the byVariable in the object.
    obj->data->SetByVariable(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetByVariable(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetByVariable()?1L:0L);
    return retval;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetDefaultVariable(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged as first member of a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyUnicode_Check(packaged_args))
            args = packaged_args;
    }

    if (!PyUnicode_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a unicode string");
    }

    char const *val = PyUnicode_AsUTF8(args);
    std::string cval = std::string(val);

    if (val == 0 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as utf8 string");
    }

    Py_XDECREF(packaged_args);

    // Set the defaultVariable in the object.
    obj->data->SetDefaultVariable(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetDefaultVariable(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    PyObject *retval = PyString_FromString(obj->data->GetDefaultVariable().c_str());
    return retval;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetScalarVariableNames(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    stringVector vec;

    if (PyUnicode_Check(args))
    {
        char const *val = PyUnicode_AsUTF8(args);
        std::string cval = std::string(val);
        if (val == 0 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ string");
        }
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyUnicode_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a unicode string", (int) i);
            }

            char const *val = PyUnicode_AsUTF8(item);
            std::string cval = std::string(val);

            if (val == 0 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ string", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more string(s)");

    obj->data->GetScalarVariableNames() = vec;
    // Mark the scalarVariableNames in the object as modified.
    obj->data->SelectScalarVariableNames();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetScalarVariableNames(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the scalarVariableNames.
    const stringVector &scalarVariableNames = obj->data->GetScalarVariableNames();
    PyObject *retval = PyTuple_New(scalarVariableNames.size());
    for(size_t i = 0; i < scalarVariableNames.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyString_FromString(scalarVariableNames[i].c_str()));
    return retval;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetVisualVariableNames(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    stringVector vec;

    if (PyUnicode_Check(args))
    {
        char const *val = PyUnicode_AsUTF8(args);
        std::string cval = std::string(val);
        if (val == 0 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ string");
        }
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyUnicode_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a unicode string", (int) i);
            }

            char const *val = PyUnicode_AsUTF8(item);
            std::string cval = std::string(val);

            if (val == 0 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ string", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more string(s)");

    obj->data->GetVisualVariableNames() = vec;
    // Mark the visualVariableNames in the object as modified.
    obj->data->SelectVisualVariableNames();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetVisualVariableNames(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the visualVariableNames.
    const stringVector &visualVariableNames = obj->data->GetVisualVariableNames();
    PyObject *retval = PyTuple_New(visualVariableNames.size());
    for(size_t i = 0; i < visualVariableNames.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyString_FromString(visualVariableNames[i].c_str()));
    return retval;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetExtentMinima(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    doubleVector vec;

    if (PyNumber_Check(args))
    {
        double val = PyFloat_AsDouble(args);
        double cval = double(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ double");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ double");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            double val = PyFloat_AsDouble(item);
            double cval = double(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more doubles");

    obj->data->GetExtentMinima() = vec;
    // Mark the extentMinima in the object as modified.
    obj->data->SelectExtentMinima();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetExtentMinima(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the extentMinima.
    const doubleVector &extentMinima = obj->data->GetExtentMinima();
    PyObject *retval = PyTuple_New(extentMinima.size());
    for(size_t i = 0; i < extentMinima.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(extentMinima[i]));
    return retval;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetExtentMaxima(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    doubleVector vec;

    if (PyNumber_Check(args))
    {
        double val = PyFloat_AsDouble(args);
        double cval = double(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ double");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ double");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            double val = PyFloat_AsDouble(item);
            double cval = double(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more doubles");

    obj->data->GetExtentMaxima() = vec;
    // Mark the extentMaxima in the object as modified.
    obj->data->SelectExtentMaxima();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetExtentMaxima(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the extentMaxima.
    const doubleVector &extentMaxima = obj->data->GetExtentMaxima();
    PyObject *retval = PyTuple_New(extentMaxima.size());
    for(size_t i = 0; i < extentMaxima.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(extentMaxima[i]));
    return retval;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetExtentScale(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    doubleVector vec;

    if (PyNumber_Check(args))
    {
        double val = PyFloat_AsDouble(args);
        double cval = double(val);
        if (val == -1 && PyErr_Occurred())
        {
            PyErr_Clear();
            return PyErr_Format(PyExc_TypeError, "number not interpretable as C++ double");
        }
        if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            return PyErr_Format(PyExc_ValueError, "number not interpretable as C++ double");
        vec.resize(1);
        vec[0] = cval;
    }
    else if (PySequence_Check(args) && !PyUnicode_Check(args))
    {
        vec.resize(PySequence_Size(args));
        for (Py_ssize_t i = 0; i < PySequence_Size(args); i++)
        {
            PyObject *item = PySequence_GetItem(args, i);

            if (!PyNumber_Check(item))
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_TypeError, "arg %d is not a number type", (int) i);
            }

            double val = PyFloat_AsDouble(item);
            double cval = double(val);

            if (val == -1 && PyErr_Occurred())
            {
                Py_DECREF(item);
                PyErr_Clear();
                return PyErr_Format(PyExc_TypeError, "arg %d not interpretable as C++ double", (int) i);
            }
            if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
            {
                Py_DECREF(item);
                return PyErr_Format(PyExc_ValueError, "arg %d not interpretable as C++ double", (int) i);
            }
            Py_DECREF(item);

            vec[i] = cval;
        }
    }
    else
        return PyErr_Format(PyExc_TypeError, "arg(s) must be one or more doubles");

    obj->data->GetExtentScale() = vec;
    // Mark the extentScale in the object as modified.
    obj->data->SelectExtentScale();

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetExtentScale(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    // Allocate a tuple the with enough entries to hold the extentScale.
    const doubleVector &extentScale = obj->data->GetExtentScale();
    PyObject *retval = PyTuple_New(extentScale.size());
    for(size_t i = 0; i < extentScale.size(); ++i)
        PyTuple_SET_ITEM(retval, i, PyFloat_FromDouble(extentScale[i]));
    return retval;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetVariableDisplay(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if ((val == -1 && PyErr_Occurred()) || long(cval) != val)
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }

    if (cval < 0 || cval >= 4)
    {
        std::stringstream ss;
        ss << "An invalid variableDisplay value was given." << std::endl;
        ss << "Valid values are in the range [0,3]." << std::endl;
        ss << "You can also use the following symbolic names:";
        ss << " NodeHeight";
        ss << ", CellHeight";
        ss << ", VariableIndex";
        ss << ", OriginalData";
        return PyErr_Format(PyExc_ValueError, ss.str().c_str());
    }

    Py_XDECREF(packaged_args);

    // Set the variableDisplay in the object.
    obj->data->SetVariableDisplay(ExtrudeStackedAttributes::VariableDisplayType(cval));

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetVariableDisplay(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetVariableDisplay()));
    return retval;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetLength(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    double val = PyFloat_AsDouble(args);
    double cval = double(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ double");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(double(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ double");
    }

    Py_XDECREF(packaged_args);

    // Set the length in the object.
    obj->data->SetLength(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetLength(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    PyObject *retval = PyFloat_FromDouble(obj->data->GetLength());
    return retval;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetSteps(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    int cval = int(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ int");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ int");
    }

    Py_XDECREF(packaged_args);

    // Set the steps in the object.
    obj->data->SetSteps(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetSteps(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(long(obj->data->GetSteps()));
    return retval;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_SetPreserveOriginalCellNumbers(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;

    PyObject *packaged_args = 0;

    // Handle args packaged into a tuple of size one
    // if we think the unpackaged args matches our needs
    if (PySequence_Check(args) && PySequence_Size(args) == 1)
    {
        packaged_args = PySequence_GetItem(args, 0);
        if (PyNumber_Check(packaged_args))
            args = packaged_args;
    }

    if (PySequence_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "expecting a single number arg");
    }

    if (!PyNumber_Check(args))
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_TypeError, "arg is not a number type");
    }

    long val = PyLong_AsLong(args);
    bool cval = bool(val);

    if (val == -1 && PyErr_Occurred())
    {
        Py_XDECREF(packaged_args);
        PyErr_Clear();
        return PyErr_Format(PyExc_TypeError, "arg not interpretable as C++ bool");
    }
    if (fabs(double(val))>1.5E-7 && fabs((double(long(cval))-double(val))/double(val))>1.5E-7)
    {
        Py_XDECREF(packaged_args);
        return PyErr_Format(PyExc_ValueError, "arg not interpretable as C++ bool");
    }

    Py_XDECREF(packaged_args);

    // Set the preserveOriginalCellNumbers in the object.
    obj->data->SetPreserveOriginalCellNumbers(cval);

    Py_INCREF(Py_None);
    return Py_None;
}

/*static*/ PyObject *
ExtrudeStackedAttributes_GetPreserveOriginalCellNumbers(PyObject *self, PyObject *args)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)self;
    PyObject *retval = PyInt_FromLong(obj->data->GetPreserveOriginalCellNumbers()?1L:0L);
    return retval;
}



PyMethodDef PyExtrudeStackedAttributes_methods[EXTRUDESTACKEDATTRIBUTES_NMETH] = {
    {"Notify", ExtrudeStackedAttributes_Notify, METH_VARARGS},
    {"SetAxis", ExtrudeStackedAttributes_SetAxis, METH_VARARGS},
    {"GetAxis", ExtrudeStackedAttributes_GetAxis, METH_VARARGS},
    {"SetByVariable", ExtrudeStackedAttributes_SetByVariable, METH_VARARGS},
    {"GetByVariable", ExtrudeStackedAttributes_GetByVariable, METH_VARARGS},
    {"SetDefaultVariable", ExtrudeStackedAttributes_SetDefaultVariable, METH_VARARGS},
    {"GetDefaultVariable", ExtrudeStackedAttributes_GetDefaultVariable, METH_VARARGS},
    {"SetScalarVariableNames", ExtrudeStackedAttributes_SetScalarVariableNames, METH_VARARGS},
    {"GetScalarVariableNames", ExtrudeStackedAttributes_GetScalarVariableNames, METH_VARARGS},
    {"SetVisualVariableNames", ExtrudeStackedAttributes_SetVisualVariableNames, METH_VARARGS},
    {"GetVisualVariableNames", ExtrudeStackedAttributes_GetVisualVariableNames, METH_VARARGS},
    {"SetExtentMinima", ExtrudeStackedAttributes_SetExtentMinima, METH_VARARGS},
    {"GetExtentMinima", ExtrudeStackedAttributes_GetExtentMinima, METH_VARARGS},
    {"SetExtentMaxima", ExtrudeStackedAttributes_SetExtentMaxima, METH_VARARGS},
    {"GetExtentMaxima", ExtrudeStackedAttributes_GetExtentMaxima, METH_VARARGS},
    {"SetExtentScale", ExtrudeStackedAttributes_SetExtentScale, METH_VARARGS},
    {"GetExtentScale", ExtrudeStackedAttributes_GetExtentScale, METH_VARARGS},
    {"SetVariableDisplay", ExtrudeStackedAttributes_SetVariableDisplay, METH_VARARGS},
    {"GetVariableDisplay", ExtrudeStackedAttributes_GetVariableDisplay, METH_VARARGS},
    {"SetLength", ExtrudeStackedAttributes_SetLength, METH_VARARGS},
    {"GetLength", ExtrudeStackedAttributes_GetLength, METH_VARARGS},
    {"SetSteps", ExtrudeStackedAttributes_SetSteps, METH_VARARGS},
    {"GetSteps", ExtrudeStackedAttributes_GetSteps, METH_VARARGS},
    {"SetPreserveOriginalCellNumbers", ExtrudeStackedAttributes_SetPreserveOriginalCellNumbers, METH_VARARGS},
    {"GetPreserveOriginalCellNumbers", ExtrudeStackedAttributes_GetPreserveOriginalCellNumbers, METH_VARARGS},
    {NULL, NULL}
};

//
// Type functions
//

static void
ExtrudeStackedAttributes_dealloc(PyObject *v)
{
   ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)v;
   if(obj->parent != 0)
       Py_DECREF(obj->parent);
   if(obj->owns)
       delete obj->data;
}

static PyObject *ExtrudeStackedAttributes_richcompare(PyObject *self, PyObject *other, int op);
PyObject *
PyExtrudeStackedAttributes_getattr(PyObject *self, char *name)
{
    if(strcmp(name, "axis") == 0)
        return ExtrudeStackedAttributes_GetAxis(self, NULL);
    if(strcmp(name, "byVariable") == 0)
        return ExtrudeStackedAttributes_GetByVariable(self, NULL);
    if(strcmp(name, "defaultVariable") == 0)
        return ExtrudeStackedAttributes_GetDefaultVariable(self, NULL);
    if(strcmp(name, "scalarVariableNames") == 0)
        return ExtrudeStackedAttributes_GetScalarVariableNames(self, NULL);
    if(strcmp(name, "visualVariableNames") == 0)
        return ExtrudeStackedAttributes_GetVisualVariableNames(self, NULL);
    if(strcmp(name, "extentMinima") == 0)
        return ExtrudeStackedAttributes_GetExtentMinima(self, NULL);
    if(strcmp(name, "extentMaxima") == 0)
        return ExtrudeStackedAttributes_GetExtentMaxima(self, NULL);
    if(strcmp(name, "extentScale") == 0)
        return ExtrudeStackedAttributes_GetExtentScale(self, NULL);
    if(strcmp(name, "variableDisplay") == 0)
        return ExtrudeStackedAttributes_GetVariableDisplay(self, NULL);
    if(strcmp(name, "NodeHeight") == 0)
        return PyInt_FromLong(long(ExtrudeStackedAttributes::NodeHeight));
    if(strcmp(name, "CellHeight") == 0)
        return PyInt_FromLong(long(ExtrudeStackedAttributes::CellHeight));
    if(strcmp(name, "VariableIndex") == 0)
        return PyInt_FromLong(long(ExtrudeStackedAttributes::VariableIndex));
    if(strcmp(name, "OriginalData") == 0)
        return PyInt_FromLong(long(ExtrudeStackedAttributes::OriginalData));

    if(strcmp(name, "length") == 0)
        return ExtrudeStackedAttributes_GetLength(self, NULL);
    if(strcmp(name, "steps") == 0)
        return ExtrudeStackedAttributes_GetSteps(self, NULL);
    if(strcmp(name, "preserveOriginalCellNumbers") == 0)
        return ExtrudeStackedAttributes_GetPreserveOriginalCellNumbers(self, NULL);


    // Add a __dict__ answer so that dir() works
    if (!strcmp(name, "__dict__"))
    {
        PyObject *result = PyDict_New();
        for (int i = 0; PyExtrudeStackedAttributes_methods[i].ml_meth; i++)
            PyDict_SetItem(result,
                PyString_FromString(PyExtrudeStackedAttributes_methods[i].ml_name),
                PyString_FromString(PyExtrudeStackedAttributes_methods[i].ml_name));
        return result;
    }

    return Py_FindMethod(PyExtrudeStackedAttributes_methods, self, name);
}

int
PyExtrudeStackedAttributes_setattr(PyObject *self, char *name, PyObject *args)
{
    PyObject NULL_PY_OBJ;
    PyObject *obj = &NULL_PY_OBJ;

    if(strcmp(name, "axis") == 0)
        obj = ExtrudeStackedAttributes_SetAxis(self, args);
    else if(strcmp(name, "byVariable") == 0)
        obj = ExtrudeStackedAttributes_SetByVariable(self, args);
    else if(strcmp(name, "defaultVariable") == 0)
        obj = ExtrudeStackedAttributes_SetDefaultVariable(self, args);
    else if(strcmp(name, "scalarVariableNames") == 0)
        obj = ExtrudeStackedAttributes_SetScalarVariableNames(self, args);
    else if(strcmp(name, "visualVariableNames") == 0)
        obj = ExtrudeStackedAttributes_SetVisualVariableNames(self, args);
    else if(strcmp(name, "extentMinima") == 0)
        obj = ExtrudeStackedAttributes_SetExtentMinima(self, args);
    else if(strcmp(name, "extentMaxima") == 0)
        obj = ExtrudeStackedAttributes_SetExtentMaxima(self, args);
    else if(strcmp(name, "extentScale") == 0)
        obj = ExtrudeStackedAttributes_SetExtentScale(self, args);
    else if(strcmp(name, "variableDisplay") == 0)
        obj = ExtrudeStackedAttributes_SetVariableDisplay(self, args);
    else if(strcmp(name, "length") == 0)
        obj = ExtrudeStackedAttributes_SetLength(self, args);
    else if(strcmp(name, "steps") == 0)
        obj = ExtrudeStackedAttributes_SetSteps(self, args);
    else if(strcmp(name, "preserveOriginalCellNumbers") == 0)
        obj = ExtrudeStackedAttributes_SetPreserveOriginalCellNumbers(self, args);

    if (obj != NULL && obj != &NULL_PY_OBJ)
        Py_DECREF(obj);

    if (obj == &NULL_PY_OBJ)
    {
        obj = NULL;
        PyErr_Format(PyExc_NameError, "name '%s' is not defined", name);
    }
    else if (obj == NULL && !PyErr_Occurred())
        PyErr_Format(PyExc_RuntimeError, "unknown problem with '%s'", name);

    return (obj != NULL) ? 0 : -1;
}

static int
ExtrudeStackedAttributes_print(PyObject *v, FILE *fp, int flags)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)v;
    fprintf(fp, "%s", PyExtrudeStackedAttributes_ToString(obj->data, "",false).c_str());
    return 0;
}

PyObject *
ExtrudeStackedAttributes_str(PyObject *v)
{
    ExtrudeStackedAttributesObject *obj = (ExtrudeStackedAttributesObject *)v;
    return PyString_FromString(PyExtrudeStackedAttributes_ToString(obj->data,"", false).c_str());
}

//
// The doc string for the class.
//
#if PY_MAJOR_VERSION > 2 || (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION >= 5)
static const char *ExtrudeStackedAttributes_Purpose = "This class contains attributes for the extrude operator.";
#else
static char *ExtrudeStackedAttributes_Purpose = "This class contains attributes for the extrude operator.";
#endif

//
// Python Type Struct Def Macro from Py2and3Support.h
//
//         VISIT_PY_TYPE_OBJ( VPY_TYPE,
//                            VPY_NAME,
//                            VPY_OBJECT,
//                            VPY_DEALLOC,
//                            VPY_PRINT,
//                            VPY_GETATTR,
//                            VPY_SETATTR,
//                            VPY_STR,
//                            VPY_PURPOSE,
//                            VPY_RICHCOMP,
//                            VPY_AS_NUMBER)

//
// The type description structure
//

VISIT_PY_TYPE_OBJ(ExtrudeStackedAttributesType,         \
                  "ExtrudeStackedAttributes",           \
                  ExtrudeStackedAttributesObject,       \
                  ExtrudeStackedAttributes_dealloc,     \
                  ExtrudeStackedAttributes_print,       \
                  PyExtrudeStackedAttributes_getattr,   \
                  PyExtrudeStackedAttributes_setattr,   \
                  ExtrudeStackedAttributes_str,         \
                  ExtrudeStackedAttributes_Purpose,     \
                  ExtrudeStackedAttributes_richcompare, \
                  0); /* as_number*/

//
// Helper function for comparing.
//
static PyObject *
ExtrudeStackedAttributes_richcompare(PyObject *self, PyObject *other, int op)
{
    // only compare against the same type 
    if ( Py_TYPE(self) != &ExtrudeStackedAttributesType
         || Py_TYPE(other) != &ExtrudeStackedAttributesType)
    {
        Py_INCREF(Py_NotImplemented);
        return Py_NotImplemented;
    }

    PyObject *res = NULL;
    ExtrudeStackedAttributes *a = ((ExtrudeStackedAttributesObject *)self)->data;
    ExtrudeStackedAttributes *b = ((ExtrudeStackedAttributesObject *)other)->data;

    switch (op)
    {
       case Py_EQ:
           res = (*a == *b) ? Py_True : Py_False;
           break;
       case Py_NE:
           res = (*a != *b) ? Py_True : Py_False;
           break;
       default:
           res = Py_NotImplemented;
           break;
    }

    Py_INCREF(res);
    return res;
}

//
// Helper functions for object allocation.
//

static ExtrudeStackedAttributes *defaultAtts = 0;
static ExtrudeStackedAttributes *currentAtts = 0;

static PyObject *
NewExtrudeStackedAttributes(int useCurrent)
{
    ExtrudeStackedAttributesObject *newObject;
    newObject = PyObject_NEW(ExtrudeStackedAttributesObject, &ExtrudeStackedAttributesType);
    if(newObject == NULL)
        return NULL;
    if(useCurrent && currentAtts != 0)
        newObject->data = new ExtrudeStackedAttributes(*currentAtts);
    else if(defaultAtts != 0)
        newObject->data = new ExtrudeStackedAttributes(*defaultAtts);
    else
        newObject->data = new ExtrudeStackedAttributes;
    newObject->owns = true;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

static PyObject *
WrapExtrudeStackedAttributes(const ExtrudeStackedAttributes *attr)
{
    ExtrudeStackedAttributesObject *newObject;
    newObject = PyObject_NEW(ExtrudeStackedAttributesObject, &ExtrudeStackedAttributesType);
    if(newObject == NULL)
        return NULL;
    newObject->data = (ExtrudeStackedAttributes *)attr;
    newObject->owns = false;
    newObject->parent = 0;
    return (PyObject *)newObject;
}

///////////////////////////////////////////////////////////////////////////////
//
// Interface that is exposed to the VisIt module.
//
///////////////////////////////////////////////////////////////////////////////

PyObject *
ExtrudeStackedAttributes_new(PyObject *self, PyObject *args)
{
    int useCurrent = 0;
    if (!PyArg_ParseTuple(args, "i", &useCurrent))
    {
        if (!PyArg_ParseTuple(args, ""))
            return NULL;
        else
            PyErr_Clear();
    }

    return (PyObject *)NewExtrudeStackedAttributes(useCurrent);
}

//
// Plugin method table. These methods are added to the visitmodule's methods.
//
static PyMethodDef ExtrudeStackedAttributesMethods[] = {
    {"ExtrudeStackedAttributes", ExtrudeStackedAttributes_new, METH_VARARGS},
    {NULL,      NULL}        /* Sentinel */
};

static Observer *ExtrudeStackedAttributesObserver = 0;

std::string
PyExtrudeStackedAttributes_GetLogString()
{
    std::string s("ExtrudeStackedAtts = ExtrudeStackedAttributes()\n");
    if(currentAtts != 0)
        s += PyExtrudeStackedAttributes_ToString(currentAtts, "ExtrudeStackedAtts.", true);
    return s;
}

static void
PyExtrudeStackedAttributes_CallLogRoutine(Subject *subj, void *data)
{
    typedef void (*logCallback)(const std::string &);
    logCallback cb = (logCallback)data;

    if(cb != 0)
    {
        std::string s("ExtrudeStackedAtts = ExtrudeStackedAttributes()\n");
        s += PyExtrudeStackedAttributes_ToString(currentAtts, "ExtrudeStackedAtts.", true);
        cb(s);
    }
}

void
PyExtrudeStackedAttributes_StartUp(ExtrudeStackedAttributes *subj, void *data)
{
    if(subj == 0)
        return;

    currentAtts = subj;
    PyExtrudeStackedAttributes_SetDefaults(subj);

    //
    // Create the observer that will be notified when the attributes change.
    //
    if(ExtrudeStackedAttributesObserver == 0)
    {
        ExtrudeStackedAttributesObserver = new ObserverToCallback(subj,
            PyExtrudeStackedAttributes_CallLogRoutine, (void *)data);
    }

}

void
PyExtrudeStackedAttributes_CloseDown()
{
    delete defaultAtts;
    defaultAtts = 0;
    delete ExtrudeStackedAttributesObserver;
    ExtrudeStackedAttributesObserver = 0;
}

PyMethodDef *
PyExtrudeStackedAttributes_GetMethodTable(int *nMethods)
{
    *nMethods = 1;
    return ExtrudeStackedAttributesMethods;
}

bool
PyExtrudeStackedAttributes_Check(PyObject *obj)
{
    return (obj->ob_type == &ExtrudeStackedAttributesType);
}

ExtrudeStackedAttributes *
PyExtrudeStackedAttributes_FromPyObject(PyObject *obj)
{
    ExtrudeStackedAttributesObject *obj2 = (ExtrudeStackedAttributesObject *)obj;
    return obj2->data;
}

PyObject *
PyExtrudeStackedAttributes_New()
{
    return NewExtrudeStackedAttributes(0);
}

PyObject *
PyExtrudeStackedAttributes_Wrap(const ExtrudeStackedAttributes *attr)
{
    return WrapExtrudeStackedAttributes(attr);
}

void
PyExtrudeStackedAttributes_SetParent(PyObject *obj, PyObject *parent)
{
    ExtrudeStackedAttributesObject *obj2 = (ExtrudeStackedAttributesObject *)obj;
    obj2->parent = parent;
}

void
PyExtrudeStackedAttributes_SetDefaults(const ExtrudeStackedAttributes *atts)
{
    if(defaultAtts)
        delete defaultAtts;

    defaultAtts = new ExtrudeStackedAttributes(*atts);
}

